package net.lab1024.sa.admin.module.business.erp.poo.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.erp.poo.domain.form.StoordAddForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.form.StoordQueryForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.form.StoordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.poo.domain.vo.StoordVO;
import net.lab1024.sa.admin.module.business.erp.poo.service.StoordService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 采购入库单 Controller
 *
 * @Author AKITA
 * @Date 2025-07-25 09:40:52
 * @Copyright AKITA
 */

@RestController
@Tag(name = "采购入库单")
public class StoordController {

    @Resource
    private StoordService stoordService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/stoord/queryPage")

    public ResponseDTO<PageResult<StoordVO>> queryPage(@RequestBody @Valid StoordQueryForm queryForm) {
        return ResponseDTO.ok(stoordService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/stoord/add")

    public ResponseDTO<Long> add(@RequestBody @Valid StoordAddForm addForm) {
        return stoordService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/stoord/update")

    public ResponseDTO<String> update(@RequestBody @Valid StoordUpdateForm updateForm) {
        return stoordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/stoord/batchDelete")

    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return stoordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/stoord/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return stoordService.delete(id);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/stoord/info/{id}")
    public ResponseDTO<StoordVO> info(@PathVariable Long id) {
        return stoordService.info(id);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/stoord/infoUnexecute/{id}")
    public ResponseDTO<StoordVO> infoUnexecute(@PathVariable Long id) {
        return stoordService.infoUnexecute(id);
    }


}
